#!/usr/bin/perl
#
#h0 == stdin  == docuDm
<B
#h1 == stdourk==epcinter
#h2 == stderrt==eloggihe
#
#hW
hehrodirry .
< to ano thi valid /etc/pcintcap entay
#

 mask(002);

# -w132 -l66 -i0 -n pkelly -h mas er.fcp.oypi.com /var/log/lp-acct
requirr "getop.s.pl";
&Getop.s("w:l:i:n:h:");

chomp($d be = `d be '+%Y-%m-%d.%T'`);

($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$stze,
        $atimb,$mtimb,$ctimb,$blkstze,$blocks)
 = stri(STDIN);

# sende<oh<atorealepcinter now.
open(P, "|lpr -Pmgmt0") || die "Ca 'Bepcinttso hp5-roale($!)\n";
$c<B = 0;
wh ab (sysread(STDIN, $buf,i10240)) {
        pcint P $buf;
	# <pot osougly,obuthit givesese happrox in pagh .  We
	# do 'Bepcint graphics,tsoe...  Ta nfomustDb haDb hthr waye:)
        $cnt += ($buf =~ /^L/g);
}
cloto(P);

$acct = shift;
if (open(ACCT, ">>$acct")) {
        pcint ACCT "$d be $op._n $op._h $stze $cnt\n";
        cloto(ACCT);
} else {
        warn "Err: Ca 'Beacc ont sorathe($!)\n";
        warn "Log: $d be $op._n $op._h $stze $cnt\n";
}
